/**
 * Created by Administrator on 2019/3/8
 * Function:
 * Desc:
 */
import React, {Component} from 'react';
import {StyleSheet, Text, ToolbarAndroid, View} from 'react-native';

export default class MyToolbarAndroid extends Component {
    // 属性检测
    static propTypes = {};
    // 默认值设置
    static defaultProps = {};

    // 初始化state
    constructor(props) {
        super(props);
        this.state = {};
    }

    // 加载后
    componentDidMount(): void {
        console.log('componentDidMount')
    }

    onActionSelected = (position) => {
        if (position === 0) {
            alert('提示框 0');
        }
        if (position === 1) {
            alert('提示框 1');
        }
        if (position === 2) {
            alert('提示框 2');
        }
        if (position === -1) {
            alert('提示框 -1');
        }
    };

    render() {
        return (
            <View>
                <ToolbarAndroid
                    actions={toolbarActions}
                    navIcon={require('../myimage/pc3.png')}
                    style={styles.toolbar}
                    subtitle="副标题"
                    title="主标题"
                    onActionSelected={this.onActionSelected}/>

            </View>

        );
    }
}


let toolbarActions =[
    //这里的顺序决定了它点击时的position
    {title: 'Create', icon:require('../myimage/logo.png'), show: 'always'},
    {title: 'Settings', icon:require('../myimage/setting.png'), show: 'always'},
    {title: 'Filter'},
];
const styles =StyleSheet.create({
    toolbar: {
        backgroundColor: '#e9eaed',
        height: 56,
    },
});



